<template>
  <div>
    <el-container>
      <el-header>&nbsp;人力资源管理系统</el-header>
      <el-container class="container">
        <el-aside width="300px">
          <Menu></Menu>
        </el-aside>
        <el-container>
          <el-main>
            <el-row>
              <el-col :span="24">
                <div class="grid-content bg-purple-dark">
                  <span>薪酬标准变更</span>
                </div>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="3">
                <div class="grid-content bg-purple">标准编号</div>
              </el-col>
              <el-col :span="6">
                <div class="grid-content bg-purple-light">标准名称</div>
              </el-col>
              <el-col :span="3">
                <div class="grid-content bg-purple">制定人</div>
              </el-col>
              <el-col :span="2">
                <div class="grid-content bg-purple-light">职位分类</div>
              </el-col>
              <el-col :span="2">
                <div class="grid-content bg-purple">职位名称</div>
              </el-col>
              <el-col :span="2">
                <div class="grid-content bg-purple-light">职称</div>
              </el-col>
              <el-col :span="3">
                <div class="grid-content bg-purple">薪酬总额</div>
              </el-col>
              <el-col :span="3">
                <div class="grid-content bg-purple-light">更改</div>
              </el-col>
            </el-row>
            <el-row v-for="(item, index) in salaryStandFileList" :key="index">
              <el-col :span="3">
                <div class="grid-content bg-purple">{{ item.salaryId }}</div>
              </el-col>
              <el-col :span="6">
                <div class="grid-content bg-purple-light">{{ item.salaryName }}</div>
              </el-col>
              <el-col :span="3">
                <div class="grid-content bg-purple">{{ item.maker }}</div>
              </el-col>
              <el-col :span="2">
                <div class="grid-content bg-purple-light">{{ item.cjobId }}</div>
              </el-col>
              <el-col :span="2">
                <div class="grid-content bg-purple">{{ item.njobId }}</div>
              </el-col>
              <el-col :span="2">
                <div class="grid-content bg-purple-light">{{ item.tjobId }}</div>
              </el-col>
              <el-col :span="3">
                <div class="grid-content bg-purple">{{ item.totalFormatted }}</div>
              </el-col>
              <el-col :span="3">
                <div class="grid-content bg-purple-light">
                  <el-button type="primary" round @click="detail(item.salaryId)">更改</el-button>
                </div>
              </el-col>
            </el-row>
          </el-main>
        </el-container>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import { defineComponent, ref, computed } from 'vue';
import { Location, Document, Menu as IconMenu, Setting } from '@element-plus/icons-vue';
import Menu from "@/components/Menu";

export default defineComponent({
  name: "SalaryStandFileChange",
  components: {
    Menu,
    Location,
    Document,
    Setting,
    IconMenu,
  },

  data() {
    return {
      salaryStandFileList: [], // 假设这是一个数组，存储从后端获取的数据
    };
  },

  methods: {
    detail(id) {
      this.$router.push("/SalaryStandardChange/" + id);
    },
    formatData() {
      this.salaryStandFileList.forEach(item => {
        item.totalFormatted = parseFloat(item.total).toFixed(2);
      });
    },
  },

  created() {
    const _this = this;
    _this.axios.get("/salary/changeSelectBriefly").then(res => {
      _this.salaryStandFileList = res.data.data;
      _this.formatData(); // 获取数据后格式化
    });
  },
});
</script>

<!--
<style scoped>
/* 样式保持不变 */
</style>
-->

<style scoped>
.el-header{
  background-color: #409EFF;
  color: #e9eef3;
  text-align: left;
  line-height: 60px;
  font-size: 30px;
}
.el-aside {
  background-color: #d3dce6;
  color: var(--el-text-color-primary);
  text-align: center;
  /*line-height: 860px;*/
}

.el-main {
  background-color: #e9eef3;
  color: var(--el-text-color-primary);
  text-align: center;
  line-height: 30px;
}

body > .el-container {
  margin-bottom: 400px;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}

.el-row {
  margin-bottom: 20px;
}

.el-row :last-child {
  margin-bottom: 0;
}

.el-col {
  border-radius: 4px;
}
.bg-purple-dark {
  background: #99a9bf;
}
.bg-purple {
  background: #d3dce6;
}
.bg-purple-light {
  background: #e5e9f2;
}
.grid-content {
  border-radius: 4px;
  min-height: 36px;
}
.row-bg {
  padding: 10px 0;
  background-color: #f9fafc;
}

.high-row{
  min-height: 200px;
}

.container{
  min-height: 860px;
}

.line {
  width: 70%;
}

.line div {
  width: 100%;
  height: 0;
  border-top: 1px solid var(--el-border-color-base);
}

</style>